package com.bw.wxy.fragment;

import android.os.Bundle;

import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.bw.wxy.R;
import com.bw.wxy.mvp.view.pople.adapter.PeopleVpAdapter;
import com.flyco.tablayout.SlidingTabLayout;

import java.util.ArrayList;
import java.util.List;

public class Fragment_pople extends Fragment {

    private View inflate;
    private PeopleVpAdapter peopleVpAdapter;
    private SlidingTabLayout peopleTab;
    private ViewPager peopleVp;

    public Fragment_pople() {
        // Required empty public constructor
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        inflate = inflater.inflate(R.layout.fragment_pople, container, false);

        peopleTab = inflate.findViewById(R.id.people_tab);
        peopleVp = inflate.findViewById(R.id.people_vp);

        List<Fragment> list=new ArrayList<>();
        list.add(new Fragment_Recommend());
        list.add(new Fragment_Follow());
        List<String> strings=new ArrayList<>();
        strings.add("推荐");
        strings.add("关注");
        peopleVpAdapter=new PeopleVpAdapter(getChildFragmentManager(),list,strings);
        peopleVp.setAdapter(peopleVpAdapter);
        peopleVp.setCurrentItem(0);
        peopleTab.setViewPager(peopleVp);

        return inflate;
    }
}